package algorithm;

import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: Sabbath
 * Date: 2009-12-28
 * Time: 22:50:00
 * To change this template use File | Settings | File Templates.
 */
public class EchoString {
    public static void main(String[] args) throws IOException {

        byte[] container = new byte[123456];
        int read = 0;
        int total = 0;
        
        while (((read = System.in.read()) != -1) && (read != '\n')) {
            if (total + 1 > container.length) {
                byte[] oldArray = container;
                container = new byte[total * 2];
                for (int i = 0; i < total; i++) {
                    container[i] = oldArray[i];
                }
            }
            container[total] = (byte) read;
            total++;
        }

        for (int i = total; i > 0; i--) {
            System.out.println((char) container[i - 1]);
        }
    }
}
